<%@ page language="java" pageEncoding="UTF-8"%>
<%@ include file="/jsp/common/headMain.jsp" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">

<html>
  <head>
    <title>My JSP 'MyJsp.jsp' starting page</title>
	<script type="text/javascript">
		$(function(){
			// 地址树
			jQuery.tree.util.addressTree("_addressTree");
			// 增加或修改地区
			jQuery.div.util.dialogInit("增加/修改地区", "_addOrUpdateAddress", 500,400);
			
			jQuery.div.util.dialogInit("地区单选树", "_addressTreeRD", 100,400);
			
	$('#tabs').tabs({  
        load: function(event, ui) {  
            var url = $.data(ui.tab, 'load.tabs');             
            if( url ) {
                $('#' + ui.panel.id).load(url);    
                return false;  
            }  
            return true;  
        }  
    });
		});
		// 增加地区
		function _addAddress(){
			var parentid = $("#parentid").val();
			$('#_addOrUpdateAddress').dialog('open').load(jQuery.getBasePath() +'/address_enterAddOrUpdateAddress/'+parentid,function(){
				jQuery.div.util.hideLoading();
			});
		}
		function _addressTreeRD(){
			$('#_addressTreeRD').dialog('open').load(jQuery.getBasePath() +'/address_enterAddressTreeRD',function(){
				jQuery.div.util.hideLoading();
			});
		}
		function _saveAddress(){
			$.post(jQuery.getBasePath() +"/address_saveAddressRelation", 
				$('#_form').serialize(), 
				function(response) {
				
			}, "json");
		}
	</script>
<body>
<div class="subScroll tree_subScroll" id="subScroll"><!-- 滚动条 -->
			<table cellpadding="0" cellspacing="0" border="0" class="treeListTable">
				<tr>
					<td width="200">
						<div class="treeList">
							<ul id="_addressTree" class="ztree"></ul>
						</div>
					</td>
					<td width="*" >
							<div class="mainTable">
								<div class="tabsTable" style="margin:20px 20px 0;">
									<div id="tabs"> 
									    <ul> 
									        <li><a href="#tabs-1">基本信息</a></li> 
									        <li><a href="ExamManagerAction?flag=addExamInfoNext&nextTabName=ExamAddPaper&examID=">XXX</a></li>  
									    </ul> 
										<div id="tabs-1">  
											<form id="_form">
												<div class="planInfo">
													<ul>
														<li style="width:70px;"><span>岗位编号：</span><div id="codeSM"></div></li>
														<li><span>岗位名称：</span><div id="nameSM"></div></li>
														<li><span>岗位描述：</span><div id="remarkeSM"></div></li>
														
														<li><span>地址类型：</span>
																<select id="type" name="type"> 
																	<option value="1">用户地址</option>
																	<option value="2">商家地址</option>
																</select>
														</li>
														<li><span>用户或商家ID		</span>
															<input type="text" id="mainid" name="mainid"/>
														</li>
														<li><span>例子 选择地区：	</span><input type="text" id="addressID" 		name="addressid"/><input type="text" id="addressNAME" name="placename"/><input type="button" value="选择" onclick="_addressTreeRD();" /></li>
														<li><span>详细地址：		</span><input type="text" id="addressdetail"  	name="addressdetail"/></li>
													</ul>
													<div class="clearfloat"></div>
												 </div>
											</form>
										 </div>
									</div>
									<div class="contBtn btn">
										<strong class="btnOff"><em class="addIcon"></em><input type="button" value="保存用户/商家地址" onclick="_saveAddress();"/></strong>
						            	<strong class="btnOff"><em class="addIcon"></em><input type="button" value="增加地区" onclick="_addAddress();"/></strong>
						            </div>
								</div>
							</div>
					</td>
				</tr>
			</table>
			<!-- 增加或修改 dialog -->
			<input id="parentid" type="hidden" value="-1"/><!-- 选中节点的id -->
			<div id="_addOrUpdateAddress"></div><!--增加地址页面-->
			<div id="_addressTreeRD"></div><!--地址数 单选页面-->
			
		</div>
	</body>
</html>
		
